package com.ruoyi.ade.service.impl;

import java.util.List;

import com.ruoyi.ade.mapper.AdeRagLabResultMapper;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ade.mapper.AdeRagLabMapper;
import com.ruoyi.ade.domain.AdeRagLab;
import com.ruoyi.ade.service.IAdeRagLabService;
import org.springframework.transaction.annotation.Transactional;

/**
 * Ade Rag LabService业务层处理
 * 
 * @author wxh
 * @date 2025-07-23
 */
@Service
public class AdeRagLabServiceImpl implements IAdeRagLabService 
{
    @Autowired
    private AdeRagLabMapper adeRagLabMapper;

    @Autowired
    private AdeRagLabResultMapper adeRagLabResultMapper;

    /**
     * 查询Ade Rag Lab
     * 
     * @param id Ade Rag Lab主键
     * @return Ade Rag Lab
     */
    @Override
    public AdeRagLab selectAdeRagLabById(Long id)
    {
        return adeRagLabMapper.selectAdeRagLabById(id);
    }

    /**
     * 查询Ade Rag Lab列表
     * 
     * @param adeRagLab Ade Rag Lab
     * @return Ade Rag Lab
     */
    @Override
    public List<AdeRagLab> selectAdeRagLabList(AdeRagLab adeRagLab)
    {
        return adeRagLabMapper.selectAdeRagLabList(adeRagLab);
    }

    /**
     * 新增Ade Rag Lab
     * 
     * @param adeRagLab Ade Rag Lab
     * @return 结果
     */
    @Override
    public int insertAdeRagLab(AdeRagLab adeRagLab)
    {
        adeRagLab.setCreateTime(DateUtils.getNowDate());
        return adeRagLabMapper.insertAdeRagLab(adeRagLab);
    }

    /**
     * 修改Ade Rag Lab
     * 
     * @param adeRagLab Ade Rag Lab
     * @return 结果
     */
    @Override
    public int updateAdeRagLab(AdeRagLab adeRagLab)
    {
        return adeRagLabMapper.updateAdeRagLab(adeRagLab);
    }

    /**
     * 批量删除Ade Rag Lab
     * 
     * @param ids 需要删除的Ade Rag Lab主键
     * @return 结果
     */
    @Override
    @Transactional
    public int deleteAdeRagLabByIds(Long[] ids)
    {
        for(Long id:ids)
            adeRagLabResultMapper.deleteAdeRagLabResultByRagLabId(id);
        return adeRagLabMapper.deleteAdeRagLabByIds(ids);
    }

    /**
     * 删除Ade Rag Lab信息
     * 
     * @param id Ade Rag Lab主键
     * @return 结果
     */
    @Override
    @Transactional
    public int deleteAdeRagLabById(Long id)
    {
        adeRagLabResultMapper.deleteAdeRagLabResultByRagLabId(id);
        return adeRagLabMapper.deleteAdeRagLabById(id);
    }
}
